﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsForms
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void button9_Click(object sender, EventArgs e)
        {

        }

        private void button6_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("呵呵");
            //MessageBox.Show("呵呵","呵呵哒");
            //MessageBox.Show("呵呵", "呵呵哒",MessageBoxButtons.OKCancel);
            DialogResult result = MessageBox.Show("呵呵", "呵呵哒", MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
            // 关闭当前窗体
            if (result == DialogResult.OK) {
                this.Close();
            }

            
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            //this.BackColor = Color.Blue;
            if (this.BackColor == Color.Blue)
            {
                this.BackColor = Color.Red;
            }
            else if (this.BackColor == Color.Red)
            {
                this.BackColor = Color.White;
            }
            else {
                this.BackColor = Color.Blue;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
            if (this.txtUserName.Text.Trim().Equals(string.Empty)) {
                MessageBox.Show("请输入用户名", "呵呵哒", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Form1 frm1 = new Form1();
            frm1.username = this.txtUserName.Text.Trim();
            this.Close();
            frm1.Hide();
        }
    }
}
